package com.team.mapper;

import com.team.entity.Room;
import com.team.entity.Schedule;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.team.util.Doctor;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author asus
* @description 针对表【schedule(医生排期表)】的数据库操作Mapper
* @createDate 2024-07-13 14:39:19
* @Entity com.team.entity.Schedule
*/
public interface ScheduleMapper extends BaseMapper<Schedule> {
    @Select("select schedule.user_id as id,sys_users.user_name as userName from schedule left join sys_users on schedule.user_id = sys_users.id where sign= #{sign} and schedule.department_id = #{departmentId}")
    public List<Doctor> getDoctorBySign(@Param("sign") Integer sign, @Param("departmentId") Integer departmentId);

    @Select("select schedule.id as scheduleId,room_id as id,room.name from schedule left join room on schedule.room_id = room.id where schedule.user_id=#{userId} and sign =#{sign}")
    public List<Room> getRoomByDocIdAndSign(@Param("userId") Integer userId, @Param("sign") Integer sign);
}




